package cn.disicn.common;

/**
 * 常量类
 */
public class Const {

	/**
	 * 
	 * 任务审核状态
	 */
	public enum AuditStatusEnum {
		BEING_AUDITED(0, "正在审核"), AUDIT_FAILURE(1, "审核失败"), SUCCESSFUL_AUDIT(2,
				"审核成功");

		AuditStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static AuditStatusEnum codeOf(int code) {
			for (AuditStatusEnum auditStatusEnum : values()) {
				if (auditStatusEnum.getCode() == code) {
					return auditStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}

		public static AuditStatusEnum statusValueOf(String value) {
			for (AuditStatusEnum auditStatusEnum : values()) {
				if (auditStatusEnum.getValue().equals(value)) {
					return auditStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * 任务付款状态
	 */
	public enum WhetherPay {
		NO_PAY(0, "未付款"), PAID(1, "已付款");

		WhetherPay(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static WhetherPay codeOf(int code) {
			for (WhetherPay whetherPay : values()) {
				if (whetherPay.getCode() == code) {
					return whetherPay;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}
	
	/**
	 * 
	 * @desc: 任务状态
	 */
	public enum TaskStatusEnum {
		SIGN_UP(0, "待接单"), UNDERWAY(1, "进行中"), SUBMITAUDITING(2, "审核中"), OVER(
				3, "已完结"), OVERDUE(4, "已过期");
		TaskStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static TaskStatusEnum codeOf(int code) {
			for (TaskStatusEnum taskStatusEnum : values()) {
				if (taskStatusEnum.getCode() == code) {
					return taskStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * @author zjk
	 * @date 2017年12月19日 下午3:38:32
	 * @desc 撤回任务状态
	 * 
	 */
	public enum BizJobsWithdrawStatusEnum {
		NO_WITHDRAW_STATUS(0, "撤回任务"), WITHDRAW_STATUS(1, "显示任务");
		BizJobsWithdrawStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static BizJobsWithdrawStatusEnum codeOf(int code) {
			for (BizJobsWithdrawStatusEnum withdrawStatusEnum : values()) {
				if (withdrawStatusEnum.getCode() == code) {
					return withdrawStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}

		public static BizJobsWithdrawStatusEnum statusValueOf(String value) {
			for (BizJobsWithdrawStatusEnum withdrawStatusEnum : values()) {
				if (withdrawStatusEnum.getValue().equals(value)) {
					return withdrawStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * @author zjk
	 * @date 2017年12月19日 下午3:38:32
	 * @desc 冻结用户
	 * 
	 */
	public enum UserStatusInfoEnum {
		FROZEN_BIZ_JOBS(2, "冻结用户"), THAW_BIZ_JOBS(1, "解冻用户");
		UserStatusInfoEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static UserStatusInfoEnum codeOf(int code) {
			for (UserStatusInfoEnum userStatusInfoEnum : values()) {
				if (userStatusInfoEnum.getCode() == code) {
					return userStatusInfoEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}

		public static UserStatusInfoEnum statusValueOf(String value) {
			for (UserStatusInfoEnum userStatusInfoEnum : values()) {
				if (userStatusInfoEnum.getValue().equals(value)) {
					return userStatusInfoEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}
	
	/**
	 * 
	 * @author zjk
	 * @date 2017年12月19日 下午3:38:32
	 * @desc 冻结用户
	 * 
	 */
	public enum BizJobsTypeEnum {
		FILE_BIZJOBS(1, "文案写稿任务"), TWO_TO_ONE(2, "多人单次推广"),ONE_TO_ONE(3, "单人单次推广");
		BizJobsTypeEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static BizJobsTypeEnum codeOf(int code) {
			for (BizJobsTypeEnum bizJobsTypeEnum : values()) {
				if (bizJobsTypeEnum.getCode() == code) {
					return bizJobsTypeEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}

		public static BizJobsTypeEnum statusValueOf(String value) {
			for (BizJobsTypeEnum bizJobsTypeEnum : values()) {
				if (bizJobsTypeEnum.getValue().equals(value)) {
					return bizJobsTypeEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * @desc: app问题反馈状态
	 */
	public enum AppFeedbackStatusEnum {
		NO_HANDLE(0, "未处理"), HANDLE(1, "已处理");

		AppFeedbackStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static AppFeedbackStatusEnum codeOf(int code) {
			for (AppFeedbackStatusEnum appFeedbackStatusEnum : values()) {
				if (appFeedbackStatusEnum.getCode() == code) {
					return appFeedbackStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}

		public static AppFeedbackStatusEnum statusValueOf(String value) {
			for (AppFeedbackStatusEnum appFeedbackStatusEnum : values()) {
				if (appFeedbackStatusEnum.getValue().equals(value)) {
					return appFeedbackStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * @desc: 用户类型
	 */
	public interface UserType {
		String CURRENT_USER = "secuser";
		String CURRENT_ADMIN = "secadmin";
	}

	/**
	 * 
	 * @desc: 账号类型
	 */
	public interface AccountType {
		String PHONE = "phone";
		String EMAIL = "email";
	}

	/**
	 * 
	 * @desc: 后台用户状态
	 */
	public enum AdminUserStatusEnum {
		FROZEN(0, "该账户已被冻结"), NORMAL(1, "正常");

		AdminUserStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static AdminUserStatusEnum codeOf(int code) {
			for (AdminUserStatusEnum adminUserStatusEnum : values()) {
				if (adminUserStatusEnum.getCode() == code) {
					return adminUserStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * @desc: 用户状态
	 */
	public enum UserStatusEnum {
		NOT_CERTIFIED(0, "未认证"), AUTHENTICATED(1, "已认证"), FROZEN(2, "该账户已被冻结");

		UserStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static UserStatusEnum codeOf(int code) {
			for (UserStatusEnum userStatusEnum : values()) {
				if (userStatusEnum.getCode() == code) {
					return userStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}

		public static UserStatusEnum statusValueOf(String value) {
			for (UserStatusEnum userStatusEnum : values()) {
				if (userStatusEnum.getValue().equals(value)) {
					return userStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * @desc: 付款方式
	 */
	public enum PayTypeEnum {
		ALIPAY(1, "支付宝"), WECHATPAY(2, "微信支付"), ACCOUNTBALANCE(3, "账户余额");

		PayTypeEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public String getValue() {
			return value;
		}

		public static PayTypeEnum codeOf(int code) {
			for (PayTypeEnum PayTypeEnum : values()) {
				if (PayTypeEnum.getCode() == code) {
					return PayTypeEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * @desc: 订单支付状态
	 */
	public enum OrderStatusEnum {
		CANCELED(0, "已取消"), NO_PAY(10, "未支付"), PAID(20, "已付款"), ORDER_SUCCESS(
				30, "充值成功"), ORDER_CLOSE(50, "订单关闭");

		OrderStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public String getValue() {
			return value;
		}

		public static OrderStatusEnum codeOf(int code) {
			for (OrderStatusEnum orderStatusEnum : values()) {
				if (orderStatusEnum.getCode() == code) {
					return orderStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}

		public static OrderStatusEnum statusValueOf(String value) {
			for (OrderStatusEnum orderStatusEnum : values()) {
				if (orderStatusEnum.getValue().equals(value)) {
					return orderStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * @desc: app版本更新状态
	 */
	public enum AppVersionStatusEnum {
		NO(0, "无效"), YES(1, "有效");
		AppVersionStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public String getValue() {
			return value;
		}

		public static AppVersionStatusEnum codeOf(int code) {
			for (AppVersionStatusEnum appVersionStatusEnum : values()) {
				if (appVersionStatusEnum.getCode() == code) {
					return appVersionStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}

		public static AppVersionStatusEnum statusValueOf(String value) {
			for (AppVersionStatusEnum appVersionStatusEnum : values()) {
				if (appVersionStatusEnum.getValue().equals(value)) {
					return appVersionStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * @desc: app版本是否强制更新
	 */
	public enum AppVersionForceEnum {
		NO(0, "否"), YES(1, "是");
		AppVersionForceEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public String getValue() {
			return value;
		}

		public static AppVersionForceEnum codeOf(int code) {
			for (AppVersionForceEnum appVersionForceEnum : values()) {
				if (appVersionForceEnum.getCode() == code) {
					return appVersionForceEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}

		public static AppVersionForceEnum statusValueOf(String value) {
			for (AppVersionForceEnum appVersionForceEnum : values()) {
				if (appVersionForceEnum.getValue().equals(value)) {
					return appVersionForceEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}

	/**
	 * 
	 * 撤回任务状态
	 */
	public enum WithdrawStatusEnum {
		NOT_WITHDRAW(0, "未撤回"), WITHDRAW(1, "已撤回");
		WithdrawStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static WithdrawStatusEnum codeOf(int code) {
			for (WithdrawStatusEnum withdrawStatusEnum : values()) {
				if (withdrawStatusEnum.getCode() == code) {
					return withdrawStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}
	
	/**
	 * 
	 * @desc: 付款产品名称
	 */
	public interface PaymentProduct {
		String RECHARGE = "任务发布平台充值";
		String DEPOSIT = "任务发布平台缴纳押金";
		String RELEASETASK = "发布任务所需佣金";
	}

	/**
	 * 
	 * @desc: 支付宝回调返回的状态
	 */
	public interface AlipayCallback {
		String TRADE_STATUS_WAIT_BUYER_PAY = "WAIT_BUYER_PAY";
		String TRADE_STATUS_SUCCESS = "TRADE_SUCCESS";
		String RESPONSE_SUCCESS = "success";
		String RSPONSE_FAILED = "failed";
	}

	/**
	 * 
	 * @desc: 任务列表状态
	 */
	public interface BizJobsStatus {
		String SIGN_UP = "0";
		String UNDERWAY = "1";
		String SUBMITAUDITING = "2";
		String OVER = "3";
		String END = "4";
	}

	/**
	 * 
	 * @desc: 任务订单列表状态
	 */
	public interface BizJobsOrderStatus {
		String SIGN_UP = "0";
		String UNDERWAY = "1";
		String SUBMITAUDITING = "2";
		String OVER = "3";
		String OVERDUE = "4";
		String CANCEL = "5";
	}

	/**
	 * 
	 * @desc: 任务订单是否通过
	 */
	public interface BizJobsOrderConfirmResult {
		String PASS = "1";
		String NOPASS = "0";
	}

	/**
	 * 
	 * @desc: 任务提交审核状态
	 */
	public interface BizJobsOrderSubmitResultAuditResult {
		String NOPASS = "0";
		String PASS = "1";
		String AGAIN = "2";
	}

	/**
	 * 
	 * @desc: 邮件类型
	 */
	public interface EmailType {
		String BIND_ACCOUNT = "bindAccount"; // 修改邮箱时发送邮件验证码
		String FORGET_PWD = "forgetPwd"; // 忘记密码时发送邮件验证码
	}

	/**
	 * 
	 * @desc: 返回给用户的错误提示信息
	 */
	public interface ErrorResult {
		String PARAMETER_EMPTY = "参数为空";
		String PASSWORD_ERROR = "密码错误";
		String PARAMETER_ERROR = "参数错误";
		String ACCOUNT_REGISTERED = "该账号已注册";
		String ACCOUNT_NOT_EXIST = "该账号不存在";
		String ACCOUNT_EXIST = "该用户名已存在";
		String SEND_CODE_EXCESSIVE = "验证码发送次数过多，请明日再试";
		String VALI_CODE_ERROR = "验证码错误";
		String CHANGE_FAIL = "修改失败";
		String NO_CHANGE = "没有改变";
	}

	/**
	 * 
	 * @desc: 实名认证类型
	 */
	public interface AuthType {
		String PERSONAL_AUTH = "personalAuth"; // 个人认证
		String ENTERPRISE_AUTH = "enterpriseAuth"; // 企业认证
		Integer PERSONAL_AUTH_CODE = 0;
		Integer ENTERPRISE_AUTH_CODE = 1;
	}

	/**
	 * 
	 * @desc: 缓存类型
	 */
	public interface CacheType {
		String SMS_CODE = "SMSCode";
		String EMAIL_CODE = "emailCode";
		String ORDER_NO = "orderNo";
		String IMG_CODE = "imgCode";
	}

	/**
	 * 
	 * @desc: 任务撤回状态
	 */
	public interface BizJobsWithdrawStatus {
		String NO_WITHDRAW_STATUS = "0";
		String WITHDRAW_STATUS = "1";
	}
	
	/**
	 * 任务退款状态
	 */
	public enum RefundStatusEnum {
		BEING_AUDITED(0, "正在审核"), AUDIT_FAILURE(1, "审核失败"), Refunded(2, "已退款");

		RefundStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private int code;
		private String value;

		public int getCode() {
			return code;
		}

		public void setCode(int code) {
			this.code = code;
		}

		public String getValue() {
			return value;
		}

		public void setValue(String value) {
			this.value = value;
		}

		public static RefundStatusEnum codeOf(int code) {
			for (RefundStatusEnum refundStatusEnum : values()) {
				if (refundStatusEnum.getCode() == code) {
					return refundStatusEnum;
				}
			}
			throw new RuntimeException("没有找到对应的枚举");
		}
	}
	
	/**
	 * 交易记录类型
	 */
	public interface TransactionType {
		final Integer RECHARGE = 0; // 充值
		final Integer CONSUMPTION = 1; // 消费
		final Integer REFUND = 2; // 退款
	}
	
	/**
	 * 
	 *  微信回调的状态
	 */
	public interface WechatpayResultCode {
		final String RESULT_SUCCESS = "SUCCESS";
		final String RESULT_FAIL = "FAIL";
	}
	
	// 微信商户证书地址
	public static String certLocalPath = "/WEB-INF/cert/apiclient_cert.p12";
	
}
